﻿@model Guardian.Domain.Target.TargetDto
@{
    ViewData["Title"] = "Details";
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.WideContainer = true;
}

<div class="container">
    <div class="row">
        <div class="col-12">
            <h3>
                <small>
                    @if (Model.State == Guardian.Infrastructure.Entity.TargetState.Redirected)
                    {
                        <i class="fas fa-check-circle text-success"></i>
                    }
                    else
                    {
                        <i class="fas fa-times-circle text-danger"></i>
                    }
                </small> @Model.Domain
                <small>
                    / @Model.OriginIpAddress
                </small>

                <span class="btn-group">
                    <button class="btn btn-info btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
                    <span class="dropdown-menu dropdown-menu-right" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px);">
                        <a class="dropdown-item" asp-action="Update" asp-route-id="@Model.Id">Edit</a>
                        <a class="dropdown-item" asp-action="Index" asp-controller="/FirewallRules" asp-route-id="@Model.Id">Firewall Rules</a>
                        <span class="dropdown-divider"></span>
                        <form asp-controller="/Targets" asp-action="Delete" class="">
                            @Html.Hidden("id", Model.Id)
                            <button class="dropdown-item" type="submit">Delete</button>
                        </form>
                    </span>
                </span>
            </h3>
        </div>
    </div>

    <div class="row mt-4">
        <partial name="_TargetInfo.cshtml" />
    </div>
</div>
<div>
    <div class="row">
        <div class="col-md-6">
            <canvas id="requestChart" style="width: 100%; height: 320px"></canvas>
        </div>
        <div class="col-md-6">
            <canvas id="requestTimeChart" style="width: 100%; height: 320px"></canvas>
        </div>
        <div class="col-md-6">
            <canvas id="ruleChart" style="width: 100%; height: 320px"></canvas>
        </div>
        <div class="col-md-6">
            <canvas id="ruleTimeChart" style="width: 100%; height: 320px"></canvas>
        </div>
    </div>
</div>


@section Scripts{
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css" />
    <script src="~/lib/Chart.js/Chart.min.js" asp-append-version="true"></script>
    <script src="~/js/details.js" asp-append-version="true"></script>
}
